home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <proto/utility.h>
- #include <math.h>
- #include <i64.h>
- #include <flashmandel.h>
-
- // fixed point math 6.58
- #define INTEGER_BITS 6L
- #define FLOAT_BITS 58L
- #define H_FLOAT_BITS (FLOAT_BITS / 2)
-
- #define KMULT (1L << H_FLOAT_BITS)
-
- #ifdef FIXEDPOINT_MATH
-
- WORD Mandeln68K_Fixed (ULONG Iterazioni,ULONG Power,LDouble Cre,LDouble Cim)
- {
- register WORD Exp;
- FIXED_64 zr,zi,zr2,zi2,cre,cim,tmp;
- FIXED_64 maxdist;
-
- tmp = i64_uset (4L);
- maxdist = i64_lshift (tmp,FLOAT_BITS);
-
- tmp = i64_uset (KMULT);
- cre = i64_set ((LONG) (Cre * KMULT));
- cim = i64_set ((LONG) (Cim * KMULT));
-
- cre = i64_mul (cre,tmp);
- cim = i64_mul (cim,tmp);
-
- zr = cre;
- zi = cim;
-
- do {
- for (Exp = Power; Exp != -1; Exp--)
- {
- zi = i64_urshift (zi,H_FLOAT_BITS);
-
- zr = i64_urshift (zr,H_FLOAT_BITS);
-
- zi2 = i64_mul (zi,zi);
-
- zi = i64_mul (zr,zi);
-
- zr2 = i64_mul (zr,zr);
-
- zr = i64_sub (zr2,zi2);
-
- zi = i64_add (zi,zi);
- }
-
- if (i64_cmp (i64_add (zr2,zi2),maxdist) == I64_GREATER ) return Iterazioni;
-
- zi = i64_add (zi,cim);
-
- zr = i64_add (zr,cre);
-
- } while (--Iterazioni != -1);
-
- return 0;
- }
- #endif
-
-